﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucRevenues.ascx.cs" Inherits="BSC.costs.ucRevenues" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<ext:XScript ID="XScript1" runat="server">
    <script type="text/javascript">
        var checkType=function()
        {
            var arr=#{FileUploadField1}.getValue().split(".");
            
            if(arr[arr.length-1]!="xls")
            {
                Ext.Msg.show({ 
                    title   : 'Error', 
                    msg     : 'Vui lòng chọn file excel', 
                    minWidth: 200, 
                    modal   : true, 
                    icon    : Ext.Msg.ERROR, 
                    buttons : Ext.Msg.OK 
                });
                #{btnUpload}.setDisabled(true);
            }
            else
            {
                #{btnUpload}.setDisabled(false);
            }
            
        }
//        var SRResultInfo = function(result) {
//            //#{grdSReport}.reload();
//            Ext.Msg.show({
//                title: 'Thông báo',
//                msg: result.extraParamsResponse.msg,
//                buttons: Ext.Msg.OK,
//                icon: Ext.MessageBox.INFO,
//                cls: 'x-window-dlg',
//                width:300,
//                animEl: 'elId'
//            }).getDialog().getEl().setStyle('z-index', '999999');
//             //if(result.extraParamsResponse.type=="success")
//                //#{grdSReport}.reload();
//        }
    </script>
</ext:XScript>
<ext:DesktopWindow ID="winRevImport" runat="server" Width="400" Height="101" Frame="true"
    Title="Import doanh thu" MonitorValid="true" >
    <%--<Items>
        <ext:FormPanel ID="frmCostUpload" runat="server" Layout="AbsoluteLayout" Border="false"
           FileUpload="true" BodyStyle="background:#DFE8F6" PaddingSummary="10px 10px 10px 10px">
            <Items>
                 
                <ext:FileUploadField ID="FileUploadField1" runat="server" 
                    Width="350" Icon="Attach" EmptyText="Chọn file..." LabelWidth="10">
                    <Listeners>
                        <FileSelected Handler="checkType()" />
                    </Listeners>
                </ext:FileUploadField>
                   
            </Items>           
            <BottomBar>
                <ext:StatusBar ID="StatusBar1" runat="Server">
                    <Items>
                        <%--<ext:Button ID="Button1"  runat="Server" Text="Optimize" Icon="Accept">
                            <DirectEvents>
                                <Click OnEvent="OptimizeCode" Before="return #{frmCostUpload}.getForm().isValid()"
                                    Success="SRResultInfo(1,'Optimize thành công')" Failure="alert(result);SRResultInfo(0,'Có lỗi phát sinh trong quá trình Optimize')"/>
                            </DirectEvents>
                        </ext:Button>
                        <ext:Button ID="btnUpload"  Disabled="true" runat="Server" Text="Import" Icon="Disk">
                            <DirectEvents>
                                <Click OnEvent="Upload" Before="return #{frmCostUpload}.getForm().isValid()" 
                                    Success="SRResultInfo(1,'Import thành công')" Failure="SRResultInfo(0,'Có lỗi phát sinh trong quá trình import')">
                                    <EventMask ShowMask="true" Msg="Đang xử lý dữ liệu" />
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                    </Items>
                </ext:StatusBar>
            </BottomBar>
        </ext:FormPanel>
    </Items>--%>
    <AutoLoad Url="costs/fact_rev_import.aspx" Mode="IFrame" ShowMask="true">
        
    </AutoLoad>
</ext:DesktopWindow>